﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Text;

namespace WFL.Threading
{
    public class BatchConfigurationElement : ConfigurationElement
    {
        [ConfigurationProperty("name"
            , IsKey = true)]
        public string Name
        {
            get { return (string)this["name"]; }
            set { this["name"] = value; }
        }

        [ConfigurationProperty("type"
            , IsRequired = true)]
        public string Type
        {
            get { return (string)this["type"]; }
            set { this["type"] = value; }
        }

        [ConfigurationProperty("startTime")]
        public string StartTime
        {
            get { return (string)this["startTime"]; }
            set { this["startTime"] = value; }
        }

        [ConfigurationProperty("interval")]
        public string Interval
        {
            get { return (string)this["interval"]; }
            set { this["interval"] = value; }
        }

        public NameValueCollection Parameters
        {
            get;
            private set;
        }

        public BatchConfigurationElement()
        {
            Parameters = new NameValueCollection();
        }

        protected override bool OnDeserializeUnrecognizedAttribute(string name, string value)
        {
            Parameters.Add(name, value);
            return true;
        }
    }
}
